#pragma once

#include <stdlib.h>
#include <stdio.h>
#include <string.h>

typedef unsigned long long int long_bit_block;

typedef struct
{
  long_bit_block * b0;
  long_bit_block * b1;
  long_bit_block * b2;
  long_bit_block * b3;
  long_bit_block * b4;
  long_bit_block * b5;
  long_bit_block * b6;
  long_bit_block * b7;
} long_bits;

#define BUILDLONGBITS() { \
    (long_bit_block *) calloc(4, sizeof(long_bit_block)), \
    (long_bit_block *) calloc(4, sizeof(long_bit_block)), \
    (long_bit_block *) calloc(4, sizeof(long_bit_block)), \
    (long_bit_block *) calloc(4, sizeof(long_bit_block)), \
    (long_bit_block *) calloc(4, sizeof(long_bit_block)), \
    (long_bit_block *) calloc(4, sizeof(long_bit_block)), \
    (long_bit_block *) calloc(4, sizeof(long_bit_block)), \
    (long_bit_block *) calloc(4, sizeof(long_bit_block)) \
  }

void LongBitsSbox(long_bits in, long_bits * out);
int Block2LongBits(unsigned char *block, long_bits *out);
int LongBits2Block(long_bits in, unsigned char * out);